//
//  ZYFormView.m
//  Tourism
//
//  Created by 张亚 on 16/1/23.
//  Copyright © 2016年 zhikuiyu. All rights reserved.
//

#import "ZYFormView.h"
#import "ZYChartView.h"

#import "ZYFormViewCell.h"


@interface ZYFormView ()<UITableViewDataSource,UITableViewDelegate>
{

}
@property (nonatomic,strong) NSArray * dataSource;

@end

@implementation ZYFormView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self configure];
//        [self createdWithTableView];
    }
    return self;
}
- (void)configure{

    UIScrollView * scrView = [[UIScrollView alloc]initWithFrame:self.bounds];
    scrView.contentSize = CGSizeMake(0, 800);
    
    [scrView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"back2"]]];
    [self addSubview:scrView];
    
    
    CGFloat healthX = 0;
    CGFloat healthY = 0;
    CGFloat healthW = SCREEN_WIDTH;
    CGFloat healthH = 100;
    UILabel * heaLabel = [[UILabel alloc]initWithFrame:CGRectMake(healthX, healthY, healthW, healthH)];
    heaLabel.text = @"健康综合报表";
    heaLabel.textColor = [UIColor blackColor];
    heaLabel.textAlignment = NSTextAlignmentCenter;
    heaLabel.font = [UIFont systemFontOfSize:20];
    
    [scrView addSubview:heaLabel];
    
    
    //画折线图
    ZYChartView * chartView = [[ZYChartView alloc]initWithFrame:CGRectMake(0, 200, SCREEN_WIDTH, 300)];
    chartView.backgroundColor = [UIColor grayColor];
    [scrView addSubview:chartView];
    
    
    
    
    

}
- (void) circleChart{
    


}























































- (void)createdWithTableView{
    UITableView * tabView = [[UITableView alloc]initWithFrame:self.bounds style:UITableViewStylePlain];
    tabView.delegate = self;
    tabView.dataSource = self;
    [self addSubview:tabView];
    
    //表头
    UIView * titleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100)];
    tabView.tableHeaderView = titleView;
    
    CGFloat healthX = 0;
    CGFloat healthY = 0;
    CGFloat healthW = SCREEN_WIDTH;
    CGFloat healthH = 100;
    UILabel * heaLabel = [[UILabel alloc]initWithFrame:CGRectMake(healthX, healthY, healthW, healthH)];
    heaLabel.text = @"健康综合报表";
    heaLabel.textColor = [UIColor grayColor];
    heaLabel.textAlignment = NSTextAlignmentCenter;
    heaLabel.font = [UIFont systemFontOfSize:20];
    
    [titleView addSubview:heaLabel];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    ZYFormViewCell * cell = [ZYFormViewCell cellWithTableView:tableView];
    //画折线图
    ZYChartView * chartView = [[ZYChartView alloc]initWithFrame:CGRectMake(0, 200, SCREEN_WIDTH, 300)];
    chartView.backgroundColor = [UIColor grayColor];
    
    
    return cell;
}





@end
